package content.views.works;
import feffects.easing.Quad;
import feffects.easing.Quint;
import js.Lib;
import tools.ASprite;

/**
 * ...
 * @author PRASS
 */

class NavItemWorks extends ASprite 
{
	
	private var _selected 	: Bool;
	private var _roll		: ASprite;
	
	public function new( dom : JQuery,id:Int) 
	{
		super(dom);
		
		_roll = new ASprite( new JQuery("#" + id) );
		
		_roll.dom.mouseover( function(e) { _rollOver(e); } );
		_roll.dom.mouseout( function(e) { _rollOut(e); } );
		
		_roll.setAlpha(1);
		
		setAlpha(0);
		setX(-100);
	}	
	
	public function select() : Void
	{
		_selected = true;
		dom.css("cursor", "default");
	}
	
	public function unselect() : Void
	{
		_selected = false;
		dom.css("cursor", "pointer");
		_rollOut(null);
	}
	
	private function _rollOver(e) : Void
	{
		if (_selected) return;
		tween(_roll.getAlpha(), _roll.setAlpha, 0, 300, Quad.easeInOut);
	}
	
	private function _rollOut(e) : Void
	{
		if (_selected) return;
		tween(_roll.getAlpha(), _roll.setAlpha, 1, 200, Quad.easeInOut);
	}


	
}